From: Roan Kattouw Date: Thu, 2 Feb 2012 16:31:42 +0000 (+0000) Subject: Fix bug in CSSJanus where background-position and background-position-x weren't flipp... X-Git-Tag: 1.31.0-rc.0~24962 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=2d3862484c7e5f1424a5151022ee07f19bd1628a;p=lhc%2Fweb%2Fwiklou.git Fix bug in CSSJanus where background-position and background-position-x weren't flipped if negative values were given. Trevor found this by running the original CSSJanus test suite against his NodeJS port; I should port the test suite to PHPUnit some time --- diff --git a/includes/libs/CSSJanus.php b/includes/libs/CSSJanus.php index e6940ea8ce..c8fc296b32 100644 --- a/includes/libs/CSSJanus.php +++ b/includes/libs/CSSJanus.php @@ -113,8 +113,8 @@ class CSSJanus { $patterns['four_notation_color'] = "/(-color\s*:\s*){$patterns['color']}(\s+){$patterns['color']}(\s+){$patterns['color']}(\s+){$patterns['color']}/i"; // The two regexes below are parenthesized differently then in the original implementation to make the // callback's job more straightforward - $patterns['bg_horizontal_percentage'] = "/(background(?:-position)?\s*:\s*[^%]*?)({$patterns['num']})(%\s*(?:{$patterns['quantity']}|{$patterns['ident']}))/"; - $patterns['bg_horizontal_percentage_x'] = "/(background-position-x\s*:\s*)({$patterns['num']})(%)/"; + $patterns['bg_horizontal_percentage'] = "/(background(?:-position)?\s*:\s*[^%]*?)(-?{$patterns['num']})(%\s*(?:{$patterns['quantity']}|{$patterns['ident']}))/"; + $patterns['bg_horizontal_percentage_x'] = "/(background-position-x\s*:\s*)(-?{$patterns['num']})(%)/"; } /**